<?php defined('IN_IA') or exit('Access Denied');?><?php (!empty($this) && $this instanceof WeModuleSite || 1) ? (include $this->template('common/header', TEMPLATE_INCLUDEPATH)) : (include template('common/header', TEMPLATE_INCLUDEPATH));?>
<style type="text/css">
/*apps.html*/
.app a {display: block;}
.app .icon { width: 196px; height:196px;}
.app .thumbnail { min-height:276px; box-shadow:0 0 10px 0px #CCCCCC; position:relative; }
.app .thumbnail.addapp { background-color:#F9F9F9;}
.app .thumbnail.addapp .addAppBtn{ display:block; margin:15px 15px 0 15px; height:238px; border:2px dashed #BFBFBF; color:#2C2C2C; position:relative; -webkit-border-radius:10px;-moz-border-radius:10px;border-radius:10px;}
.addAppBtn .addicon {position:absolute;width:100%; padding-top:56px; height:76px; background:url(<?php echo MODULE_URL;?>static/images/add_icon.png) center top no-repeat; top:40%; text-align:center;}
.app .thumbnail.addapp .addAppBtn:hover{ text-decoration:none;}
.app .qr { position:absolute; top:5px;left:50%;margin-left: -98px; width: 196px; height:196px; overflow:hidden;}
.app .qr canvas {
    width:100%; height:100%; 
    -webkit-transform:translateY(100%);
    -moz-transform:translateY(100%);
    transform:translateY(100%); 
    -webkit-transition:all 300ms;
    -moz-transition:all 300ms;
    transition:all 300ms;
}
.app .qr.z-show canvas {
    -webkit-transform:translateY(0);
    -moz-transform:translateY(0);
    transform:translateY(0);
}
.qr_icon { 
    width:22px; height:22px; position:absolute; right:30px; 
    background-image:url(<?php echo MODULE_URL;?>static/images/qr_icon.png); background-size:contain;
}
@-webkit-keyframes rotate{
    from { -webkit-transform:rotate(0deg)} to { -webkit-transform:rotate(360deg)}
}
@-moz-keyframes rotate{
    from { -moz-transform:rotate(0deg)} to { -moz-transform:rotate(360deg)}
}
@keyframes rotate{
    from { transform:rotate(0deg)} to { transform:rotate(360deg)}
}
</style>
    <ul class="nav nav-tabs">
        <li <?php  if($status == '1') { ?>class="active"<?php  } ?>>
            <a href="<?php  echo $this->createWebUrl('myapp',array('status'=>'1'));?>">已经发布</a>
        </li>
        <li <?php  if($status == '0') { ?>class="active"<?php  } ?>>
            <a href="<?php  echo $this->createWebUrl('myapp',array('status'=>'0'));?>">未发布</a>
        </li>
    </ul>
    <div class="row">
        <div class="col-xs-4 col-md-3 app">
            <div class="thumbnail addapp">
                <a class="addAppBtn" href="<?php  echo $this->createWebUrl('factory', array('op'=>'addapp'))?>"><span class="addicon">创建新场景</span></a>
            </div>
        </div>
<?php  if(is_array($result['list'])) { foreach($result['list'] as $item) { ?>
<?php $appurl = $_W['siteroot'].'app/index.php?i='.$_W['uniacid'].'&c=entry&appid='.$item['id'].'&do=preview&m=zht_app';?>
        <div class="col-xs-4 col-md-3">
            <div class="thumbnail app">
                <a href="<?php  echo $this->createWebUrl('factory', array('op'=>'index','appid'=>$item['id']))?>">
                    <img src="<?php  echo $item['icon'];?>" class="icon" alt="APP图标">
                    <div class="qr" data-id="<?php  echo $item['id'];?>" data-url="<?php  echo $appurl;?>"></div>
                </a>
                <div class="caption">
                    <h6 class="ellipsis rp"><?php  echo cutstr($item['appname'],12,'…')?><a class="qr_icon"></a></h6>
                    <div class="clearfix text-muted mt10">
                        <span class="pull-left"><small>创建：<?php  echo date('Y-m-d H:i',$item['truetime'])?></small></span>
                    </div>
                </div>
            </div>
        </div>
<?php  } } ?>
    </div>
<?php  echo $result['pager'];?>
<script>
    require(['jquery', '<?php echo MODULE_URL;?>static/js/jquery.qrcode.min.js'],function($, qr){
        $('.app .qr').each(function(index, element) {
            $(element).qrcode({
                foreground: "#29323c",
                text : $(element).data('url'),
                width : 196,
                height : 196
            });    
        });
        $('.qr_icon').hover(function(){
            $(this).parents('.app').find('.qr').addClass('z-show');
        },function(){
            $(this).parents('.app').find('.qr').removeClass('z-show');
        });
    });
</script>
<?php (!empty($this) && $this instanceof WeModuleSite || 1) ? (include $this->template('common/footer', TEMPLATE_INCLUDEPATH)) : (include template('common/footer', TEMPLATE_INCLUDEPATH));?>